import * as types from '../action-types'
import api from '../../api'
const storeAction = {
    //异步获取收藏列表，同步到 redux
    async queryStoreListAsync() {
        let list = null;
        try {
            let { code, data } = await api.storeList();
            if (+code === 0) {
                list = data;
            }
        } catch (_) { }
        return {
            type: types.STORE_LIST,
            list
        }
    },
    //清空收藏列表
    clearStoreList() {
        return {
            type: types.STORE_LIST,
            list: null
        }
    },
    //移除某一项收藏
    removeStoreListById(id){
        return{
            type:types.STORE_REMOVE,
            id
        }
    }
}
export default storeAction